<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%
	request.setCharacterEncoding("UTF-8");
	response.setContentType("text/html;charset=UTF-8");
%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%
	String path = request.getContextPath();
%>
<html>
<head>
	    <meta charset="utf-8" />
		<title>car2go</title>
		<meta name="viewport" content="width=device-width,initial-scale=1, maximum-scale=1.0, user-scalable=no" />
		<meta content="telephone=no" name="format-detection" /> 
		<link rel="stylesheet" href="<%=path%>/css/reservation/bootstrap.min.css" />
		<link type="text/css"  rel="stylesheet" href="<%=path%>/css/reservation/style.css" />
		<link type="text/css" rel="stylesheet" href="<%=path%>/css/reservation/dropload.css">
</head>
<body>
	<body class="sy_bd begin">
		<div class="car-title">
			car2go
		</div>
		<div class="fs tabHead">
			<span><a href="#" class="a-c" id="unf">未完成</a></span>
			<span><a href="#">已完成</a></span>
		</div>	
<article class="khfxWarp">
  <section class="khfxPane" style="display:block"></section>
  <section class="khfxPane"></section>
</article>
<script src="<%=path%>/js/layer_mobile/layer.js"></script>
<script src="<%=path%>/js/reservation/jquery-2.2.3.min.js"></script>
<script type="text/javascript">
function doCancel(obj){
	var timeObjStr =  $(obj).closest('.nr-list').find(".times").text();
	var timeStr = timeObjStr.substring(0,timeObjStr.indexOf("用车"));
	var dateUseCar = new Date(timeStr);
	var now=new Date();
	var minutes = (now.getTime()-dateUseCar.getTime())/(1000*60);
	if(minutes<10){
		layer.open({
		    content: '送车时间不足10分钟，不能取消订单'
		    ,btn: '我知道了'  
		  });
		return false;
	}
	
	layer.open({
  	     type: 1,
  	     content: 
  	    	 "<div style='padding:15px;font-size:16px;'>"+
  	    	 "<div style='margin-left:10px;margin-top:10px;'><span>原因：</span>"+
  	    	 "<select onchange='changeSelCancelFb(this);' id='selCancelFb' class='sl'>"+
  	    	"<option value='1'>请选择原因</option>"+
  	    	 "<option value='1'>派送中客户取消</option>"+
  	    	 "<option value='2'>客户迟到10分钟以上</option>"+
  	    	 "<option value='3'>未派送时客户取消</option>"+
  	    	 "<option value='4'>客户拒绝支付派送费</option>"+
  	    	 "<option value='5'>大使迟到10分钟以上</option>"+
  	    	 "<option value='6'>派送中遇交通事故</option>"+
  	    	 "<option value='7'>其他请注明（填写原因）</option>"+
  	    	 "</select></div>"+
  	    	 "<div id='otherDiv' style='margin-left:10px;margin-top:10px;'>其他：<input onchange='changeTxtOtherReason(this);' disabled='disabled' id='otherReason' type='text' maxlength='15' class='sl' placeholder='最多15个字'/><input id='cancelFeedback' type='hidden' /></div><div style='margin-left:10px;'><span style='color:red;' id='errorMsg'>&nbsp;</span></div></div>"
  	    ,btn: ['确认', '返回']
    	,yes: function(index){
    		var p1=$("#selCancelFb").children('option:selected').val();
    		var cancelFeedback=$("#cancelFeedback").val().trim();
    		if(cancelFeedback==""){
    			$("#errorMsg").text("反馈不能为空！");
    		}else{
    			toCacel(obj);
    	      	layer.close(index);
    		}
    		
	    }
  	    	 /**'<div>派送员：<select><option value="">请选择</option></select></div><div style="padding:15px 5px;">备注信息：<input style="width:330px;" class="remark layui-input" type="text" placeholder="备注信息" ></div><div><input type="button" value="确认派送"/></div>'**/
  	 });
	
  }
  
function changeSelCancelFb(selObj){
	$("#cancelFeedback").val("");
	$("#otherReason").val("");
	var p1=$(selObj).children('option:selected').val();
	if(p1=="7"){
		$("#cancelFeedback").val("");
		$("#otherReason").removeAttr("disabled");
	}else{
		var p2=$(selObj).find("option:selected").text();
		$("#cancelFeedback").val(p2);
		$("#otherReason").attr("disabled", true);
	}
}
function changeTxtOtherReason(txtObj){
	$("#cancelFeedback").val($(txtObj).val());
}
  
function toCacel(obj){
	 var rid = $(obj).closest('.nr-list').find(".rid").text();
	 var phone = $(obj).closest('.nr-list').find('.phone').text();
	 var cancelFeedback=$("#cancelFeedback").val().trim();
   	$.ajax({  
	    	 type: "post",
            url:"<%=path%>/resManage/beicancel.html", 
          	 data: {rid:rid,phone:phone,cancelFeedback:cancelFeedback},
            dataType: "text",
            async:false,
            timeout: 10000,  
            cache: false,  
            error: eerrorFunction,  //错误执行方法    
            success: ssuccessFunction //成功执行方法    
        });
   	 $(obj).closest('.nr-list').hide();
	    }
function finis(obj){
	 //询问框
	  layer.open({
	    content: '确认任务完成？'
	    ,btn: ['确认', '返回']
	    ,yes: function(index){
	      queren(obj);
	      layer.close(index);
	    }
	  });
	
   }
		 function queren(obj){
        	 var rid = $(obj).closest('.nr-list').find(".rid").text();
        	 var phone = $(obj).closest('.nr-list').find('.phone').text();
		    	$.ajax({  
			    	 type: "post",
		             url:"<%=path%>/resManage/finis.html", 
		           	 data: {rid:rid,phone:phone},
		           	 async:false,
		             dataType: "text",  
		             timeout: 1000,  
		             cache: false,  
		             error: eerrorFunction,  //错误执行方法    
		             success: ssuccessFunction //成功执行方法    
		         });
		    	 $(obj).closest('.nr-list').hide();
			    }
		 function eerrorFunction() {  
             alert("系统忙，请稍后重试");
        }  
		 function ssuccessFunction(data) {
			 layer.closeAll();
		 }
		
		</script>
<script src="<%=path%>/js/reservation/dropload.js"></script>
<script src="<%=path%>/js/reservation/khData.js"></script>
		<script src="http://res.wx.qq.com/open/js/jweixin-1.1.0.js"></script>
		<script type="text/javascript">
		 var max = '${fn:length(resList)}';
		 var pth = '<%=path%>';
		 var pid = '${pId}';
		 var pageSum = '${pageSum}';
		 var pageSum2 = '${pageSum2}';
		
		 function getNowFormatDate(time) {
			    var date = new Date(time);
			    var seperator1 = "-";
			    var seperator2 = ":";
			    var year = date.getFullYear();
			    var month = date.getMonth() + 1;
			    var strDate = date.getDate();
			    if (month >= 1 && month <= 9) {
			        month = "0" + month;
			    }
			    if (strDate >= 0 && strDate <= 9) {
			        strDate = "0" + strDate;
			    }
			    var currentdate = year + seperator1 + month + seperator1 + strDate
			            + " " + date.getHours() + seperator2 + date.getMinutes()
			            + seperator2 + date.getSeconds();
			    return currentdate;
			}
		$('.fs span a').click(function(){
			$('.fs span a').removeClass('a-c');
			$(this).addClass('a-c');
		})
	
		$(document).ready(function(){
				
		});
		
	</script>
		<script>
		    $(window).load(function() {
				var cityHeight=$('.allhead .bd .city2 img').height()/6*5;
				$('.allhead .bd').height(cityHeight);
				var pdHeight=$('.allhead .paodao2 img').height();
				$('.allhead .paodao2').height(pdHeight);
				var ulWidth=$('.front-img li').width();
				$('.front-img li').height(ulWidth);
            });
		</script>
		<script type="text/javascript">
		
		//微信jssdk config
		wx.config({
			debug : false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
			appId : '${appid}', // 必填，公众号的唯一标识
			timestamp : '${timestamp}', // 必填，生成签名的时间戳
			nonceStr : '${noncestr}', // 必填，生成签名的随机串
			signature : '${signature}',// 必填，签名，见附录1
			jsApiList : [ 'checkJsApi', //判断当前客户端版本是否支持指定JS接口
			'onMenuShareTimeline', //分享给好友
			'onMenuShareAppMessage', //分享到朋友圈
			]
		// 必填，需要使用的JS接口列表，所有JS接口列表见附录2
		});
		wx.ready(function() { //ready函数用于调用API，如果你的网页在加载后就需要自定义分享和回调功能，需要在此调用分享函数。//如果是微信游戏结束后，需要点击按钮触发得到分值后分享，这里就不需要调用API了，可以在按钮上绑定事件直接调用。因此，微信游戏由于大多需要用户先触发获取分值，此处请不要填写如下所示的分享API
					wx.onMenuShareTimeline({ //分享到朋友圈的API  
								title : '接招！car2go接力go', // 分享标题
								link : 'http://run.xuanzhen-tech.com/car2go_wx/core/getRelay.html?relayNo='+reNo, // 分享链接
								imgUrl : 'http://run.xuanzhen-tech.com/car2go_wx/img/car2.jpg', // 分享图标
								success : function() {
									// 用户确认分享后执行的回调函数
								},
								cancel : function() {
									// 用户取消分享后执行的回调函数
								}
							});
					wx.onMenuShareAppMessage({//分享到朋友 
								title : '接招！car2go接力go', // 分享标题
								desc : 'car2go接力赢即行券，你还等什么？', // 分享描述
								link : 'http://run.xuanzhen-tech.com/car2go_wx/core/getRelay.html?relayNo='+reNo, // 分享链接
								imgUrl : 'http://run.xuanzhen-tech.com/car2go_wx/img/car2.jpg', // 分享图标
								type : 'link', // 分享类型,music、video或link，不填默认为link
								dataUrl : '', // 如果type是music或video，则要提供数据链接，默认为空
								success : function() {
									// 用户确认分享后执行的回调函数
								},
								cancel : function() {
									// 用户取消分享后执行的回调函数
								}
							});
				});
		</script>
</body>
</html>